package com.aacar.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.aacar.dao.BrandDao;
import com.aacar.dto.PageDto;
import com.aacar.entity.PageEntity;
import com.aacar.service.BrandService;
import com.aacar.vo.AllBrandVo;
import com.aacar.vo.BrandVo;
import com.aacar.vo.HotBrandVo;

/**
 * 品牌service
 * @author wangh
 *
 */
@Repository("brandService")
public class BrandServiceImpl implements BrandService{
	
	@Autowired
	private BrandDao brandDao;
	
	//获取热门品牌
	public List<HotBrandVo> getHotBrandVo() {
		return this.brandDao.getHotBrandVo();
	}
	
	
	//获取所有品牌
	public List<AllBrandVo> getAllBrandVo(PageDto pageDto) {
		PageEntity page = new PageEntity();
		int pageNo = pageDto.getPageNo();
		int pageSize = pageDto.getPageSize();
		pageNo = pageNo * pageSize;
		page.setStartRs(pageNo);
		page.setPageSize(pageDto.getPageSize());
		return this.brandDao.getAllBrandVo(page);
	}

	//获取所有品牌数量
	public int getgetAllBrandCount() {
		return this.brandDao.getAllBrandCount();
	}

	
	public BrandVo getAllBrandByBrandId(String brandId) {
		return this.brandDao.getAllBrandByBrandId(brandId);
	}

}
